package com.atguigu;

import com.atguigu.mapper.UserMapper;
import com.atguigu.pojo.User;
import com.atguigu.utils.SqlSessionUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.jupiter.api.Test;

import java.security.spec.RSAOtherPrimeInfo;

public class test {
    @Test
    public void test(){
        SqlSession sqlSession = SqlSessionUtils.openAutoCommitSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = new User();
        user.setUsername("admin");
        user.setPassword("123456");
        int insert = mapper.insert(user);
        System.out.println(insert);
        sqlSession.close();
    }
    @Test
    public void test2(){
        SqlSession sqlSession = SqlSessionUtils.openAutoCommitSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = new User();
        user.setUsername("admin22");
        user.setPassword("45676");
        System.out.println(user);
        mapper.save(user);
        System.out.println(user);
    }
}
